package com.kermitye.studentsys;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class DatabaseHelper extends SQLiteOpenHelper {

    public static final String DB_NAME = "studentsys.db";
    private static final int version = 1;


    private static final String CREATE_STUDNETS = "create table Studnets(" +
            "id integer primary key autoincrement," +
            "name varchar," +
            "speciality varchar," +
            "clazz varchar)";
    private static final String DROP_STUDENTS = "drop table if exists Studnets";

    public DatabaseHelper(@Nullable Context context) {
        super(context, DB_NAME, null, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_STUDNETS);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL(DROP_STUDENTS);
        onCreate(db);
    }

}
